
function getUserMsg(value){
  $.ajax({
      url:head+"/student/getStudent",
      dataType:"json",
      type:"POST",
      data:{"studentiden":value},
      success:function(redata){
        
          if(redata.code != 0){
              layer.msg(redata.msg, {
              time: 1500, //20s后自动关闭
              //btn: ['明白了', '知道了', '哦']
              });
              return ;
          }
          $("#studengName").attr("value",redata.data.studengName);
          $("#gender").attr("value",getGender(redata.data.gender));
          $("#studentAddr").attr("value",redata.data.studentAddr);       
      }
  });
  // alert(value);
}

function commitBtn(){
    var index = layer.load(2);
    var picIdList = [];
    var images = $('[name="images"]');
    // var images = document.getElementsByName(images);
    // images[0].
    $.each($(images),function(i,data){
        picIdList.push($(data).attr("value"));
    });
    var data = {};
    data.pics = picIdList;
    data.applicantName = $("#applicantName").val();
    data.repairAddr = $("#repairAddr").val();
    data.questionMsg = $("#msg").val();
    data.operationManager = getId();
    // console.info(JSON.stringify(data));
    var workerId = $("#worker option:selected").attr('value');
    // alert(workerId);
    // debugger;
    $.ajax({
        url:head+"/other/repair?isAlert=0",
        dataType:"JSON",
        data:JSON.stringify(data),
        contentType:"application/json;charset=UTF-8",
        type:"POST",
        success:function(redata){//插入操作，，
            // debugger;
            if(redata.code == 0){//报修成功，接下来处理
                var workerId = $("#worker option:selected").attr('value');
                var pdata = {};
                pdata.id = redata.data.id;
                pdata.operationId = getId();
                pdata.workerId = workerId;
                console.info(pdata);
                $.ajax({
                    url:head+"/other/managerRepair",
                    dataType:"json",
                    type:"post",
                    contentType:"application/x-www-form-urlencoded; charset=UTF-8",
                    data:pdata,
                    success:function(redata){
                        if(redata.code == 0){
                            layer.close(index);
                            setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
                                window.location.reload();//页面刷新
                                },1500);
                            layer.msg("报修成功", {
                            time: 1500, //20s后自动关闭
                            //btn: ['明白了', '知道了', '哦']
                            });
                            return ;
                        }else{
                            layer.close(index);
                            layer.msg(redat.msg, {
                                time: 1500, //20s后自动关闭
                                //btn: ['明白了', '知道了', '哦']
                                });
                        }
                    }
                });
            }
            else{
                layer.close(index);
                if(redata.code != 0){//报修失败
                    setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
                        // window.location.reload();//页面刷新
                        },1500);
                    layer.msg(redata.msg, {
                    time: 1500, //20s后自动关闭
                    //btn: ['明白了', '知道了', '哦']
                    });
                    return ;
                }
            }
        }
    })

}